var app = getApp();
Component({
  properties: {
        shop: Object,
        params : Object,
        isinfo : Number,
        ispay : Number,
        pdv : Number,
        iscollect : Number
    },

    data: {
        showstatus : false,
        showtel : true,
    },
    options : {
        addGlobalClass : true,
    },
    methods: {
        zanit(){
            var self = this;
            var postdata = {
                op : 'zan',
                id : self.data.shop.id,
            }
            app.com.http('shopinfo_v1','POST',postdata,0,true,'','',function(res){
                if (res.data && !res.data.errno) {
                    app.com.toast( res.data.message );
                    self.setData({
                        'shop.zan' :self.data.shop.zan*1 + 1,
                    })
                    
                }else{
                    app.com.toast( res.data.message );
                }
            });
        },
        shareit(){
            this.triggerEvent('shareshop',{});
        },
        collect(){
            var self = this;
            var postdata = {
                op : 'collect',
                id : self.data.shop.id,
            }
            app.com.http('shopinfo_v1','POST',postdata,0,true,'','',function(res){
                if (res.data && !res.data.errno) {
                    app.com.toast( res.data.message );
                    self.setData({
                        iscollect : self.data.iscollect == 1 ? 0 : 1,
                    })
                    
                }else{
                    app.com.toast( res.data.message );
                }
            });
        },
        location : function( e ){
            app.com.location( e );
        },
        otherapp : function( e ){
            app.com.otherapp( e );
        },
        toweburl : function(e){
            app.com.toweburl( e,this );
        },
        navigateto : function( e ){
            app.com.navigateto( e );
        },
        redirectto : function( e ){
            app.com.redirectto( e );
        },    
        callphone : function(e){
            app.com.callphone( e );
        },
        weburl : function(e){
            app.com.toweburl( e,this );
        },
        url : function( e ){
            app.com.navigateto( e );
        },   
        tel : function(e){
            app.com.callphone( e );
        },
        copy(e){
            wx.setClipboardData({
                data : e.currentTarget.dataset.copy
            })
        }
    }

})